/*
 * @Author: DUST
 * @Date: 2023-05-30 09:05:52
 * @LastEditors: DUST
 * @LastEditTime: 2023-06-09 14:42:40
 * @FilePath: \koa-node-ts\app\validator\TagsValidator.ts
 * @Description: 
 * undefined
 */

import { Rules } from "async-validator";

export interface tagItem {
  name: string;
  sortNum: number;
  color?: string;
}

class TagsValidator {
  /**
   * @description: 新增标签校验规则
   */  
  private _addTagRules: Rules = {
    name: [
      {
        type: "string",
        required: true,
        message: "标签名称不能为空！"
      }
    ]
  };
  public get addTagRules() : Rules {
    return this._addTagRules;
  }
  /**
   * @description: 编辑标签校验规则
   */  
  private _editTagRules: Rules = {
    name: [
      {
        type: "string",
        required: true,
        message: "标签名称不能为空！"
      }
    ],
    id: [
      {
        required: true,
        message: "缺少参数id"
      }
    ]
  };
  public get editTagRules() : Rules {
    return this._editTagRules;
  }
  
}

export default  new TagsValidator;